import TaskManageService from "@service/task-manage";
import { updateTimeStamp } from "@utils/assist";

const updateTemplateInfor = async (templateId) => {
  console.group();
  const data = await TaskManageService.taskDetail({
    id: templateId,
  });
  const { stepList: steps, description, name, tags, variables, id } = data;
  data.stepList.map((step, index) =>
    updateTimeStamp(step, data.stepList.length <= 1 ? "" : index)
  );
  console.log("原始Data", data);

  const isUpdate = await TaskManageService.taskUpdate({
    ...{ steps, description, name, tags, variables, id },
  });
  console.log("更新后Data", isUpdate);
  console.groupEnd();
};

export default updateTemplateInfor;
